package com.mofei.mall04_fileupload.controller.upload;

import com.mofei.mall04_fileupload.common.util.PdfUtil;
import com.mofei.mall04_fileupload.service.FileUploadService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@CrossOrigin
@RestController
@RequestMapping("/file/api")
public class FileUploadApi {
    @Resource
    private FileUploadService fileUploadService;

    @RequestMapping("/upload")
    public String uploadFile(String Type,@RequestParam(value = "pictureFiles", required = false) MultipartFile[] pictureFiles) {
        fileUploadService.uploadFile(Type,pictureFiles);
        System.out.println("导出成功");
        return "导出！";
    }

    @RequestMapping("/uploadByFolder")
    public String uploadByFolder(String folder,String Type) {
        fileUploadService.uploadByFolder(folder,Type);
        System.out.println("导出成功");
        return "导出！";
    }

}
